package com.shujia.flink.tf

import org.apache.flink.api.common.functions.FilterFunction
import org.apache.flink.streaming.api.scala._

object Demo4Filter {
  def main(args: Array[String]): Unit = {

    val env: StreamExecutionEnvironment = StreamExecutionEnvironment.getExecutionEnvironment

    val studentsDS: DataStream[String] = env.readTextFile("data/students.txt")


    val filterDS: DataStream[String] = studentsDS.filter(new FilterFunction[String] {
      override def filter(value: String): Boolean = {
        value.split(",")(3).equals("男")
      }
    })

    filterDS.print()

    env.execute()


  }

}
